<?php
/**
* @version 0.1
* @licsense        GNU/GPL, see LICENSE.php
* @author Gonzalo Diaz Cruz - http://devgon.wordpress.com
*/

/**
* Transforms any URL in a HTML link
*/
class Rox_View_Helper_UrlToLink
{
    /**
    * @param string text with urls
    * @return string
    */
    public function urlToLink($str = '')
    {
        $str = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\" rel=\"nofollow\">\\0</a>", $str);
        return $str;
    }
}